<?php
/**
 * Wiki page
 * 
 *     SCMwiki Copyright (C) 2010  Callan Bryant <callan1990@googlemail.com>
 *     
 *     Based on Voswork - A simple, fast PHP filesystem abstraction layer
 *     Voswork Copyright (C) 2010  Callan Bryant <callan1990@googlemail.com>
 * 
 *     This program is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 * 
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 * 
 *     You should have received a copy of the GNU General Public License
 *     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * 
 * @package main
 * @author Callan Bryant <callan1990@googlemail.com>
 */

/**
 * wiki page, given path to source
 * 
 * @package core
 * @author Callan Bryant
 */
class wikiPage extends template
{
	public function __construct($path)
	{
		$this->article = scmwikiCrawler::get_article($path);

		if ($this->article->redirect)
		{
			httpResponse::redirect($this->article->redirect);
			die();
		}

		$this->title = $this->article->name;
		$this->description = $this->article->summary;
		$this->article = $this->article;
		$this->note = 
		'last modified '.template::evaluate_seconds(time()-$this->article->modified).' ago';

		if ($this->article->deserialized)
			// from cache
			$this->comment = kernel::elapsed().'ms/'.get_class(kernel::$cache);
		else
			// newly parsed
			$this->comment = kernel::elapsed().'ms';
	}
}
